﻿using AutoMapper;
using D.Medicalcare.Domain.Entities;
using D.Medicalcare.ErrorCode;
using D.Medicalcare.Read.API.Application.Command.PhysicalexaminationCommand;
using D.Medicalcare.Read.API.Application.Command.PhysicalExaminationInstructionsCommand;
using D.Medicalcare.Read.API.Application.Command.RegistrationCommand;
using D.Medicalcare.Read.API.Application.Command.ReserInstrucCommand;
using D.Medicalcare.Read.API.Dtos;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace D.Medicalcare.Read.API.Controllers
{
    /// <summary>
    /// 预约体检
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ReserInstrucController : ControllerBase
    {
        private readonly IMediator mediator;

        public ReserInstrucController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        ///预约信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<ReserInstruc>>> GetReserInstruc([FromQuery]GetReserInstrucCommand request)
        {
            return await mediator.Send(request); 
        }

        /// <summary>
        /// 体检须知
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<PhysicalExaminationInstructions>>> GetPhysicalExaminationInstructions([FromQuery]GetPhysicalExaminationInstructionsCommand request)
        {
            return await mediator.Send(request);

        }


        /// <summary>
        /// 体检显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIPaging<PhysicalexaminationDto>> GetPhysicalexamination([FromQuery]GetPhysicalexaminationCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 体检反填
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<PhysicalexaminationDto>> FtPhysicalexamination([FromQuery]FtPhysicalexaminationCommand request)
        {
            return await mediator.Send(request);
        }


        /// <summary>
        /// 查询最新预约数据
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<APIResult<Physicalexamination>> OrderPhysicalexamination([FromQuery]OrderPhysicalexaminationCommand request)
        {
            return mediator.Send(request);
        }
       

        }
}
